﻿using AutoMapper;
using Domain.Entity.Config;
using Domain.Repository.IConfig;
using Microsoft.AspNetCore.Mvc;

namespace UI.Controllers
{
    public class CPCSController : Controller
    {
        private readonly IConfig_public_charAppService cPCAppService;
        private readonly IMapper mapper;

        public CPCSController(IConfig_public_charAppService cPCAppService, IMapper mapper)
        {
            this.cPCAppService = cPCAppService;
            this.mapper = mapper;
        }
       
        public IActionResult Index()
        {
            return View();
        }
        public async Task<IActionResult> GetCPCS()
        {
            List<Config_public_char> list = await cPCAppService.GetCPCAstnc();
            return Json(list);
        }

        public async Task<IActionResult> DeleteCPCS(int id)
        {
            int i = await cPCAppService.DeleteEIAsync(id);
            return Json(i);
        }

        public async Task<IActionResult> AddCPCS(Config_public_char cpc)
        {
            int i = await cPCAppService.AddEIAsync(cpc);
            return Json(i);
        }

    }
}
